
//查看进或者没进入的用户
var user_monitoring =  {
		getUserList : function() {
			var yls_name = sessionStorage.getItem("ecdClassRoomName")
			$("#yy_name").val(yls_name);
			var  crid = sessionStorage.getItem("crid");
			$.ajax({
				type : "GET",
				url : "http://127.0.0.1:8080/yl-websocket/transmit?param='m=lookup&address=http://103.37.166.4:7777/StateGrid/ua.do",
				scriptCharset: 'utf-8', 
				success : function(param) {
//					alert(param);
					param = JSON.parse(param);
					user_monitoring.createUserList(param.data);
				},
				error: function(){
				}
				
			});
		},
		createUserList : function(users){
			var id = sessionStorage.getItem("crid");
			$("#user_list").html("");
			$("#user_bat").html("");
			$("#user_add").html("");
			var str1 = "";
			var str2 = "";
			var str3 = "";
			for(var i in users){
				if(users[i].user_crid == 'notJoinAnyClassRoom'){//未进演练室
					str1 += '<li><span></span>'+users[i].user_info.su_name+'</li>'; 
				}
				//进入的演练导调员
				else if(users[i].user_crid != 'notJoinAnyClassRoom'&& users[i].user_info.su_sr_id == "30" && users[i].classroom_info.ecdClassRoomId == id){
					str2 += '<li class="Speaker"><span></span>'+ users[i].user_info.su_name +':'+ users[i].user_info.roleName +'</li>';
				}//进入演练的人员
				else if(users[i].user_crid != "notJoinAnyClassRoom" && users[i].user_info.su_sr_id == "50" && users[i].classroom_info.ecdClassRoomId == id){
					str3 +='<li><span></span>'+ users[i].user_info.su_name +'</li>';
				}
			}
			$(str1).appendTo("#user_list");
			$(str2).appendTo("#user_bat");
			$(str3).appendTo("#user_add");
			
			
		},
	}

var user = {
		user_sj : function(){
			$.ajax({
				type : "GET",
				url : "http://127.0.0.1:8080/yl-websocket/transmit?param='m=lookup&address=http://103.37.166.4:7777/StateGrid/ua.do",
				scriptCharset: 'utf-8', 
				success : function(param) {
//					alert(param);
					param = JSON.parse(param);
					user_monitoring.createUserList(param.data);
				},
				error: function(){
				}
				
			});
		}
}





$("#userMonitoring").click(function() {
	if($(this).hasClass('active')) {
	} else {
		user_monitoring.getUserList();
	}
});

$(function(){
	$("#Refreshs").click(function(){
		user_monitoring.getUserList();
	});
//	user.user_sj();
	
})





